<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
    xmlns:s="http://jboss.org/schema/seam/taglib"
    xmlns:ui="http://java.sun.com/jsf/facelets"
    xmlns:f="http://java.sun.com/jsf/core"
    xmlns:h="http://java.sun.com/jsf/html"
    xmlns:p="http://primefaces.org/ui" 
    template="/layout/template.xhtml">

<ui:define name="body">

    <h:form id="tagSearch" styleClass="edit">

        <p:panel header="Tag Search Filter" switchType="ajax">

            <s:decorate template="/layout/display.xhtml">
                <ui:define name="label">Descricao</ui:define>
                <p:inputText id="descricao" value="#{tagList.tag.descricao}"/>
            </s:decorate>

            <s:decorate template="/layout/display.xhtml">
                <ui:define name="label">Match</ui:define>
                <p:selectOneRadio id="logic" value="#{tagList.restrictionLogicOperator}" styleClass="radio">
                    <f:selectItem itemLabel="E" itemValue="and"/>
                    <f:selectItem itemLabel="OU" itemValue="or"/>
                </p:selectOneRadio>
            </s:decorate>

        </p:panel>

        <div class="actionButtons">
            <p:commandButton id="search" value="Search" outcome="/layout/TagList.xhtml" ajax="false"/>
            <p:button id="reset" value="Reset" includePageParams="false"/>
        </div>

    </h:form>
    <s:div styleClass="actionButtons" rendered="#{empty from}">
        <p:button outcome="/pages/TagEdit.xhtml"
                    id="create"
           propagation="none"
                 value="Nova tag">
            <f:param name="tagId"/>
        </p:button>
    </s:div>
    <p:panel>
        <f:facet name="header">Tag(s) retornadas (#{empty tagList.resultList ? 0 : (tagList.paginated ? tagList.resultCount : tagList.resultList.size)})</f:facet>
    <div class="results" id="tagList">

    <h:outputText value="Nenhuma Tag encontrada."
               rendered="#{empty tagList.resultList}"/>

    <p:dataTable id="tagList"
                var="_tag"
              value="#{tagList.resultList}"
           rendered="#{not empty tagList.resultList}">
        <p:column>
            <f:facet name="header">
                <ui:include src="/layout/sort.xhtml">
                    <ui:param name="entityList" value="#{tagList}"/>
                    <ui:param name="propertyLabel" value="Id"/>
                    <ui:param name="propertyPath" value="tag.id"/>
                </ui:include>
            </f:facet>
            <h:outputText value="#{_tag.id}"/>
        </p:column>

        <p:column>
            <f:facet name="header">
                <ui:include src="/layout/sort.xhtml">
                    <ui:param name="entityList" value="#{tagList}"/>
                    <ui:param name="propertyLabel" value="Descrição"/>
                    <ui:param name="propertyPath" value="tag.descricao"/>
                </ui:include>
            </f:facet>
            <h:outputText value="#{_tag.descricao}"/>
        </p:column>
        <p:column>
            <f:facet name="header">
                <ui:include src="/layout/sort.xhtml">
                    <ui:param name="entityList" value="#{tagList}"/>
                    <ui:param name="propertyLabel" value="Data"/>
                    <ui:param name="propertyPath" value="tag.dataCriacao"/>
                </ui:include>
            </f:facet>
            <h:outputText value="#{_tag.dataCriacao}">
                <s:convertDateTime type="both" dateStyle="short"/>
            </h:outputText>
        </p:column>        
        <p:column styleClass="action">

            <p:link outcome="/pages/TagEdit.xhtml"
                   value="Edit"
             propagation="none"
                      id="tagEdit"
                rendered="#{empty from}">
                <f:param name="tagId"
                        value="#{_tag.id}"/>
            </p:link>
        </p:column>
        <f:facet name="footer">
                <p:dataScroller id="datascrollerQuestoes" />
        </f:facet>        
    </p:dataTable>

    </div>
    </p:panel>





</ui:define>

</ui:composition>
